package com.kkshop.gwt.main;

import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.ui.RootPanel;
import com.kkshop.gwt.base.Controller;
import com.kkshop.gwt.login.LoginController;
import com.kkshop.gwt.registration.RegistrationController;

public class Main implements EntryPoint {
    
    private Controller[] controllers = new Controller[] {
            new LoginController(),
            new RegistrationController()
    };

    public void onModuleLoad() {
        GWT.setUncaughtExceptionHandler(new GWT.UncaughtExceptionHandler() {
            public void onUncaughtException(Throwable t) {
                Window.alert(t.getMessage());
                GWT.log(t.getMessage(), t);
            }
        });
        
        for(int index = 0; index < controllers.length; ++index) {
            Controller controller = controllers[index];
            if(RootPanel.get(controller.getContainerId()) != null) {
                controller.initialize();
            }
        }
    }
}
